package com.wq.code;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Executor;

/**
 * @Author: wangqiang20995
 * @Date:2019/4/29
 * @Description:
 * @Resource:
 */
public class JavaBaseAPI {

    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>();
        map.put("a", "one");
        map.put("b", "two");
        map.put("c", "three");

        Map.Entry<String, String>[] entries = map.entrySet().toArray(new Map.Entry[0]);
        for (Map.Entry<String, String> entry : entries) {
            System.out.println(entry.getKey() + "/" + entry.getValue());
        }


        int[] array = new int[]{3, 2, 5, 7, 9, 12, 7, 19, 14, 1, 16, 2};
        int[] temp = new int[20];
        for (int i = 0; i < array.length; i++) {
            temp[array[i]]++;
        }


        for (int i = 0; i < 20; i++) {
            for (int j = 0; j < temp[i]; j++) {//当数组中有两个相同的数的时候，temp[i]=2
                System.out.printf("%d\t",i);
            }
        }
        System.out.println();
        System.out.println(exceptionTry());
        boolean initialized ;
        System.out.println("123");

    }

    private static int exceptionTry(){
        try {
            System.out.println("start");
            return 21;
        } catch (Exception e) {
            System.out.println("catch block 2");
        } finally {
            System.out.println("finally block 2");
        }
        return 22;
    }
}